package com.javalong.affairs.base.common;

import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.View;

/**
 * Created by Administrator on 2015/12/16 0016.
 */
public class ViewHolder extends RecyclerView.ViewHolder {
    private SparseArray<View> mViews;
    private View mView;

    public ViewHolder(View itemView) {
        super(itemView);
        this.mView = itemView;
        mViews = new SparseArray<>();
    }

    public <T extends View> T getView(int resId) {
        View view = mViews.get(resId);
        if (view == null) {
            view = mView.findViewById(resId);
            mViews.put(resId, view);
        }
        return (T) view;
    }

}
